package com.yl.zqy.service.impl.sys;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yl.zqy.common.Result;
import com.yl.zqy.entity.sys.SysDictType;
import com.yl.zqy.mapper.sys.SysDictTypeMapper;
import com.yl.zqy.service.sys.SysDictTypeService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 字典类型 服务实现类
 * </p>
 *
 * @author liang.yu
 * @since 2024-03-25
 */
@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements SysDictTypeService {

    @Override
    public Result<Boolean> insertDictType(SysDictType dictType) {
        int res = baseMapper.insert(dictType);
        if (res > 0)
            return Result.ok(true);
        return Result.error(false, "新增失败！");
    }

    @Override
    public Result<Boolean> updateDictType(SysDictType dictType) {
        int res = baseMapper.updateById(dictType);
        if (res > 0)
            return Result.ok(true);
        return Result.error(false, "修改失败！");
    }

    @Override
    public Result<List<SysDictType>> dictTypeList() {
        return Result.ok(baseMapper.selectList(null));
    }

}
